var myApp = new Framework7();
$(function () {
    getMessage();
});
function getMessage() {
    var params=JSON.stringify({"conventionerId":$.cookie("user")});
    $.ajax({
        // url:'http://125.65.40.171/conference-check/conferenceController/selectConferenceApplied',
        url:'conferenceController/selectConferenceApplied',
        dataType:'json',
        data:{"param":params},
        type:"post",
        xhrFields: {
            withCredentials: true
        },
        crossDomain: true,
        success:function (data) {
            if(data.code==200){
                $.each(data.data,function (e,v) {
                    var icon="";
                    var color="";
                    var text="";
                    if(v.isApproved==0){
                        icon="fa fa-exclamation-triangle";
                        color="red";
                        text="未通过";
                    }else if(v.isApproved==1){
                        icon="fa fa-check-square";
                        color="green";
                        text="已通过";
                    }else if(v.isApproved==2){
                        icon="fa fa-exclamation-triangle";
                        color="sandybrown";
                        text="审核中";
                    }
                    $(".meetings").append("<li>" +
                        "<a class='item-link item-content items' meetingNum='"+v.id+"'>" +
                        "<div class='item-media'>" +
                        "<i class='"+icon+"' style='color:"+color+"'></i>" +
                        "</div>" +
                        "<div class='item-inner'>" +
                        "<div class='item-title'>"+v.name+"</div>" +
                        "<div class='item-after'>"+text+"</div>" +
                        "</div>" +
                        "</a>" +
                        "</li>");
                });
                $(".items").on("click",function () {
                    var itemNum=$(this).attr("meetingnum");
                    var user=$.cookie("user");
                    window.location.href="items?meeting="+itemNum+"&user="+user;
                });
            }else if((data.code==500)){
                myApp.alert('','还没有申请的会议');
            }
        },
        error:function (XMLHttpRequest,textStatus,errorThrown) {
            myApp.alert('','系统错误，请稍后重试');
        }
    })
}